<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head></head>
<body>
<script th:src="@{|/jquery/jquery.min.js|}"></script>
<script th:src="@{|/jquery/jquery-2.1.1.min.js|}"></script>
<script th:src="@{|/jquery/jquery.md5.js|}"></script>
<script th:src="@{|/layer/layer.js|}"></script>
<nav th:fragment="nav" class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <div>
                <img th:src="@{/img/wnlogo.png}" height="50px">
                <a class="navbar-brand" style="font-size:32px;" href="#">BOSS系统 1.0</a>
            </div>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li style="padding-top:8px;">
                    <div class="btn-group">
                        <button type="button" class="btn btn-default btn-success dropdown-toggle"
                                data-toggle="dropdown">
                            <i class="glyphicon glyphicon-user"></i><shiro:principal property="uname"/><span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a th:href="@{|/personalMassage|}"><i class="glyphicon glyphicon-cog"></i> 个人设置</a></li>
                            <li><a href="#" onclick="changePwd()"><i class="glyphicon glyphicon-comment"></i> 修改密码</a></li>
                            <li class="divider"></li>
                            <li><a th:href="@{|/logOut|}"><i class="glyphicon glyphicon-off"></i> 退出系统</a></li>
                        </ul>
                    </div>
                </li>
                <li style="margin-left:10px;padding-top:8px;">
                    <button type="button" class="btn btn-default btn-danger">
                        <span class="glyphicon glyphicon-question-sign"></span> 帮助
                    </button>
                </li>
            </ul>
            <form class="navbar-form navbar-right">
                <input type="text" class="form-control" placeholder="查询">
            </form>
        </div>
    </div>
</nav>

<!-- 模态框（Modal）修改 -->
<form id="pwdEditForm">
    <div class="modal fade" id="myModal7" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title" id="myModalLabel7">修改密码</h4>
                </div>
                <div class="modal-body">
                    <div class="form-group">
                        <label for="pwd">请输入密码</label>
                        <input name="pwd" id="pwd" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="pwd1">请输入新密码</label>
                        <input name="pwd1" id="pwd1" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="pwd2">确认密码</label>
                        <input name="pwd2" id="pwd2" class="form-control">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="btnEdit">修改</button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>
</form>
</body>
</html>
<script>
    $(function (){
        $("#btnEdit").click(function (){
            var a1=$.md5($("#pwd").val())
            $("#pwd").val(a1)
            var a2=$.md5($("#pwd1").val())
            $("#pwd1").val(a2);
            var a3=$.md5($("#pwd2").val())
            $("#pwd2").val(a3);
            url="/changePwdDo";
            var da=$("#pwdEditForm").serialize();
            $.get(url,da,function (data){
                if (data.result){
                    layer.msg(data.resuleMassage, {time: 1000, icon: 4}, function () {});
                    $("#myModal7").modal("hide")
                    $("#pwdEditForm")[0].reset();
                }else {
                    layer.msg(data.resuleMassage, {time: 1000, icon: 5}, function () {});
                    $("#pwdEditForm")[0].reset();
                }
            });
        })
    })
    function changePwd(){
        $('#myModal7').modal("show");
    }
</script>
